package com.hava.contentsale.web.session;

import com.hava.contentsale.dao.ContentDao;
import com.hava.contentsale.meta.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpSession;

/**
 * Created by zhanpeng on 18/11/2016.
 */
@Component
public class UserSession {

    @Autowired
    ContentDao contentDao;

    public void setUser(HttpSession httpSession,UserVO userVO)
    {
        httpSession.setAttribute("user",userVO);
    }

    public UserVO getUser(HttpSession httpSession)
    {
        UserVO userVO = (UserVO) httpSession.getAttribute("user");
        return userVO;
    }

    public void invalidate(HttpSession httpSession)
    {
        httpSession.invalidate();
    }
}
